Performance.registerGroup({
	name: "js.object"
});

Performance.registerTest({
	group: "js.object",
	name: "get: property -existing",
	args: [25000, 50000, 100000, 150000],
	
	run: function(arg) {
		var hash = {x: 0, y: 1, z: 2};
		while(arg--) {
			var res = hash.x;
		}
	}
});

Performance.registerTest({
	group: "js.object",
	name: "get: property -existing -dynamic",
	args: [25000, 50000, 100000, 150000],
	
	run: function(arg) {
		var hash = {x: 0, y: 1, z: 2}, prop = "x";
		while(arg--) {
			var res = hash[prop];
		}
	}
});

Performance.registerTest({
	group: "js.object",
	name: "get: property -unexisting",
	args: [25000, 50000, 100000, 150000],
	
	run: function(arg) {
		var hash = {};
		while(arg--) {
			var res = hash.z;
		}
	}
});

Performance.registerTest({
	group: "js.object",
	name: "get: property -unexisting -dynamic",
	args: [25000, 50000, 100000, 150000],
	
	run: function(arg) {
		var hash = {};
		while(arg--) {
			var res = hash[arg];
		}
	}
});

Performance.registerTest({
	group: "js.object",
	name: "get: property -unexisting -dynamic -deep",
	args: [25000, 50000, 100000, 150000],
	
	run: function(arg) {
		var hash = {x: {}};
		while(arg--) {
			var res = hash.x[arg]
		}
	}
});

Performance.registerTest({
	group: "js.object",
	name: "contains: property -existing",
	args: [25000, 50000, 100000, 150000],
	
	run: function(arg) {
		var hash = {x: 0, y: 1, z: 2}, prop = "x";
		while(arg--) {
			var res = prop in hash;
		}
	}
});

Performance.registerTest({
	group: "js.object",
	name: "contains: property -unexisting",
	args: [25000, 50000, 100000, 150000],
	
	run: function(arg) {
		var hash = {};
		while(arg--) {
			var res = arg in hash;
		}
	}
});

// TODO testing for Object.get also!
Performance.registerTest({
	group: "js.object",
	name: "set: -two-parts",
	args: [25000, 50000, 100000, 150000],
	
	run: function(arg) {
		var hash = {};
		while(arg--) {
			Object.set(hash, ["simple", "path"], true);
		}
	}
});

Performance.registerTest({
	group: "js.object",
	name: "set: -five-parts",
	args: [25000, 50000, 100000],
	
	run: function(arg) {
		var hash = {};
		while(arg--) {
			Object.set(hash, ["simple", "path", "with", "five", "parts"], true);
		}
	}
});

Performance.registerTest({
	group: "js.object",
	name: "clone: -standard",
	args: [2500, 5000, 10000, 15000],
	
	run: function(arg) {
		var hash = {a: "a", b: "b", c: "c", d: "d", e: "e", int: 1, float: 1.2, fn: function(){}};
		
		while(arg--) {
			Object.clone(hash);
		}
	}
});
